<?php


namespace App\Models;


use App\Engine\BaseModel;

/**
 * Class ImageBanners
 *
 * @property int $id
 * @property string|null $url
 * @package App\Models
 */


class ImageBanners extends BaseModel
{
    protected $table = 'image_banners';
    public $timestamps = false;
    protected $fillable = [
        'name',
        'image',
        'type',
        'jump_type',
        'value',
        'sort',
        'hidden'
    ];

    public $rule=[
        "name"=>"required",
        "image"=>"required",
        "type"=>"required",
        "jump_type"=>"required",
        "sort"=>"required",
        "hidden"=>"required"
    ];

    public $ruleMessage=[
        "name.required"=>"名称不能为空",
        "image.required"=>"请上传图片",
        "type.required"=>"请选择分类",
        "jump_type.required"=>"请选择跳转类型",
        "sort.required"=>"请输入牌香烟",
        "hidden.required"=>"是否隐藏?"
    ];

    public $with=["project","custom"];

    public function project()
    {
        return $this->belongsTo("App\Models\House","value","id")->select(["id","name"]);
    }

    public function custom()
    {
        return $this->belongsTo("App\Models\Custom","value","id")->select(["id","name"]);
    }




}
